package com.woniuxy.controller;

import com.woniuxy.entity.Menu;
import com.woniuxy.service.LeftMenuTreeService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/menutree")
public class LeftMenuTreeController {
    @Autowired
    LeftMenuTreeService leftMenuTreeService;
    /**
     * 这个方法是用来获取所有的菜单数据的
     * @return
     */
    @RequestMapping("/showall")
    @RequiresRoles({"超级管理员"})
    @RequiresPermissions({"menu::find","menu::delete"})
    public List<Menu> findAll(){
        return leftMenuTreeService.findAll();
    }
    @RequestMapping("/updataFid/{fid}/{id}")
    public int updataFid(@PathVariable int fid,@PathVariable int id){
        leftMenuTreeService.updataFid(fid,id);
        return 0;
    }
}
